home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / pdox693.zip / TI1106.ASC < prev    next >
Text File  |  1992-08-17  |  9KB  |  331 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. PRODUCT  :  Paradox                                    NUMBER  :  1106
  9. VERSION  :  4.0
  10.      OS  :  DOS
  11.    DATE  :  August 17, 1992                               PAGE  :  1/5
  12.  
  13.   TITLE  :  Using IIF() To Produce Line Squeezing in Report Groups
  14.  
  15.  
  16.  
  17.  
  18. Intended Audience:
  19. This Technical Information sheet is intended for someone with a
  20. moderate level of Paradox experience.
  21.  
  22. Prerequisites:
  23. A basic understanding of the Paradox Report Generator and experience
  24. in creating calculated fields.
  25.  
  26. Purpose:
  27. The purpose of this Technical Information sheet is to illustrate one
  28. use of the Paradox 4.0 Immediate If PAL function, IIF(), for producing
  29. line squeeze in areas of a report other than the form band, such as
  30. group bands.
  31.  
  32. It is sometimes desirable to create reports that incorporate line
  33. squeezing in areas other than the form band.  A common application for
  34. the Immediate If function is creating invoice reports that contain
  35. customer address information within a group header.  In many
  36. instances, the customer record may not include data for a particular
  37. field (i.e "Company").  In Paradox versions prior to 4.0 (because
  38. there is no method of producing line squeezing in areas other than the
  39. form band) a blank line remains when the fields that are placed on a
  40. line of the report do not contain data.  The following example
  41. illustrates the use of the Immediate If function in a series of
  42. calculated fields of a report to produce line squeezing in group
  43. bands.  For additional information on the Immediate If function, refer
  44. to the PAL Reference Guide.
  45.  
  46. The IIF function returns one of two values depending on the value of a
  47. logical condition.  The syntax of the IIF function is as follows:
  48.  
  49.   IIF(Condition, ValueIfTrue, ValueIfFalse)
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. PRODUCT  :  Paradox                                    NUMBER  :  1106
  75. VERSION  :  4.0
  76.      OS  :  DOS
  77.    DATE  :  August 17, 1992                               PAGE  :  2/5
  78.  
  79.   TITLE  :  Using IIF() To Produce Line Squeezing in Report Groups
  80.  
  81.  
  82.  
  83.  
  84. Suppose you have the following customer information data in a table:
  85.  
  86.  
  87. FName╦═LName═╦════Company════╦════Address═══╦═══City═══╦═State╦ZipCode
  88. Ann  ║ Smith ║ Systems Design║ 123 Front St.║ Atlanta  ║ GA   ║ 01234
  89. John ║ Wilson║               ║ 100 Beach Dr.║ San Diego║ CA   ║ 90123
  90.  
  91.  
  92. The record for Ann Smith contains data for the field "Company";
  93. however, the "Company" field is blank for John Wilson.  Suppose you
  94. want to print out the following customer information in the "LName"
  95. group header of a report:
  96.  
  97.   FName LName
  98.   Company
  99.   Address
  100.   City, State ZipCode
  101.  
  102. Using a series of calculated fields with the IIF function you can line
  103. squeeze in the group header by evaluating the condition where the
  104. field "Company" is blank.
  105.  
  106. Pictured on the next page is an example of a tabular report that
  107. utilizes the IIF function.  The customer information (name, company
  108. and address) is placed in the "LName" group header.  All of the fields
  109. shown in the group header are calculated fields.  The actual report
  110. spec would show a field mask of "A's" in place of calc expressions.
  111.  
  112. To create a calculated field in a report:
  113.  
  114.    1.  Press <F10> to select the Report Menu
  115.  
  116.    2.  Field │ Place │ Calculated
  117.  
  118.    3.  Type in the expression
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140. PRODUCT  :  Paradox                                    NUMBER  :  1106
  141. VERSION  :  4.0
  142.      OS  :  DOS
  143.    DATE  :  August 17, 1992                               PAGE  :  3/5
  144.  
  145.   TITLE  :  Using IIF() To Produce Line Squeezing in Report Groups
  146.  
  147.  
  148.  
  149.  
  150. ....+...10....+...20....+...30....+...40....+...50....+...60....+...70
  151. page ─────────────────────────────────────────────────────────────────
  152.                                               INVOICE NO: 999999
  153.  
  154.  
  155. ───── group LName ────────────────────────────────────────────────────
  156. [FName]+" "+[LName]
  157. IIF(ISBLANK([Company]),[Address],[Company])
  158. IIF(ISBLANK([Company]),[City]+", "+[State]+" "+[ZipCode],[Address])
  159. IIF(ISBLANK([Company]),"",[City]+", "+[State]+" "+[ZipCode])
  160.  
  161. ─ table ──┬───────────────────┬───────┬──────────┬────────────────────
  162.  
  163. DATE      DESCRIPTION         QUANT   PRICE      AMOUNT
  164. --------  ------------------  ------  ---------  ----------------
  165. mm/dd/yy  AAAAAAAAAAAAAAAAAA  999999  999999.99  [Quant]*[Price]
  166. ─ table ──┴───────────────────┴───────┴──────────┴────────────────────
  167.  
  168.                    Total Amount   SUM([Quant]*[Price], group)
  169. PAGEBREAK
  170. ───── group LName ────────────────────────────────────────────────────
  171. page ─────────────────────────────────────────────────────────────────
  172. ══════════════════════════════════════════════════════════════════════
  173.  
  174.  
  175. The four calculated field expressions that are contained within the
  176. group header are evaluated as follows:
  177.  
  178. Line 1: Concatenates the "FName" field to the "LName" field and
  179.      separates the two fields with a space.
  180.  
  181. Line 2: If the "Company" field is blank, then Paradox prints the
  182.      "Address" field.  If it is not blank, then Paradox prints the
  183.      "Company" field.
  184.  
  185. Line 3: If the "Company" field is blank, then Paradox concatenates
  186.      the fields "City", "State" and "ZipCode".  If it is not blank,
  187.      then Paradox prints the "Address" field.
  188.  
  189. Line 4: If the "Company" field is blank, then Paradox prints a blank
  190.      line.  If it is not blank, then Paradox concatenates the
  191.      fields "City", "State" and "ZipCode".
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206. PRODUCT  :  Paradox                                    NUMBER  :  1106
  207. VERSION  :  4.0
  208.      OS  :  DOS
  209.    DATE  :  August 17, 1992                               PAGE  :  4/5
  210.  
  211.   TITLE  :  Using IIF() To Produce Line Squeezing in Report Groups
  212.  
  213.  
  214.  
  215.  
  216. Each invoice will be printed on a separate page.  The report output
  217. will look like this:
  218.  
  219. ---------------------------------------------------------------------
  220.                                               INVOICE NO: 1259
  221.  
  222.  
  223. Ann Smith
  224. Systems Design
  225. 123 Front St.
  226. Atlanta, GA 01234
  227.  
  228. DATE       DESCRIPTION        QUANT   PRICE      AMOUNT
  229. --------  ------------------  ------  ---------  ----------------
  230. 5/22/92   486 Computer        1       2000.00    2000.00
  231. 5/22/92   Laser Printer       2        800.00    1600.00
  232.  
  233.                            Total Amount       3600.00
  234. ---------------------------------------------------------------------
  235.                                               INVOICE NO: 1260
  236.  
  237.  
  238. John Wilson
  239. 100 Beach Dr.
  240. San Diego, CA 90123
  241.  
  242.  
  243. DATE       DESCRIPTION        QUANT   PRICE      AMOUNT
  244. --------  ------------------  ------  ---------  ----------------
  245. 5/22/92   386SX Computer      1       1500.00    1500.00
  246.  
  247.                            Total Amount       1500.00
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272. PRODUCT  :  Paradox                                    NUMBER  :  1106
  273. VERSION  :  4.0
  274.      OS  :  DOS
  275.    DATE  :  August 17, 1992                               PAGE  :  5/5
  276.  
  277.   TITLE  :  Using IIF() To Produce Line Squeezing in Report Groups
  278.  
  279.  
  280.  
  281.  
  282. ---------------------------------------------------------------------
  283.  
  284. Note that this technique emulates the "fixed" version line
  285. squeezing where the blank line(s) is "pushed" down to the bottom.
  286. Variable line squeezing is not possible due to the fact that the
  287. line must remain for potential use.
  288.  
  289. Without using the IIF function, the record for John Wilson (that has
  290. blank data for the field "Company") would have a blank line between
  291. the line for "FName" and "LName" and the line for "Address" as shown
  292. below:
  293.  
  294. ---------------------------------------------------------------------
  295.                                               INVOICE NO: 1260
  296.  
  297.  
  298. John Wilson
  299.                            <---  BLANK LINE PRODUCED HERE
  300. 100 Beach Dr.
  301. San Diego, CA 90123
  302.  
  303.  
  304. DATE      DESCRIPTION         QUANT   PRICE      AMOUNT
  305. --------  ------------------  ------  ---------  ----------------
  306. 5/22/92   386SX Computer      1       1500.00    1500.00
  307.  
  308.                            Total Amount       1500.00
  309. ---------------------------------------------------------------------
  310.  
  311. There are many different applications of the IIF function.  For
  312. additional information on the IIF function, refer to the PAL
  313. Reference Guide.
  314.  
  315. DISCLAIMER: You have the right to use this technical information
  316. subject to the terms of the No-Nonsense License Statement that you
  317. received with the Borland product to which this information pertains.
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.